
       import  './401'
       import $ from './jquery.js'


        $(function () {
            $("#load").hide();
            $("#dl").click(function () {
                if ($("#username").val() != "" && $("#password").val() != "") {
                $.ajax({
                    url: 'http://192.168.30.63:3000/users/login',
                    data: { username: $("#username").val(), password: $("#password").val() },
                    dataType: "json",
                    type: "get",
                    beforeSend: function () {
                        $("#load").show();
                    },
                    success: function (data) {
                        if (data.code == 200) {
                            localStorage.token=data.token;
                            location.href = `./main.html`;
                        } else {
                            alert("用户名或密码错误");
                        }
                    },
                    complete: function () {
                        $("#load").hide();
                    }
                })
            }else{
            alert("用户名及密码不能为空")
        }
            })
       

    });
